// ECE556 - Copyright 2013 University of Wisconsin-Madison. 
// Wiscad.  All Rights Reserved.
// Authors: Min Li and Hamid Shojaei

#include "ece556.h"
int eval_mode;
long cnt_unrouted;

int main(int argc, char **argv)
{

 	if(argc!=4){
 		printf("Usage : ./ROUTE.exe <input_benchmark_name> <output_file_name> <eval_mode>\n");
 		return 1;
 	}

 	int status;
	char *inputFileName = argv[1];
 	char *outputFileName = argv[2];
        eval_mode = atoi(argv[3]);

 	/// create a new routing instance
 	routingInst *rst = new routingInst;
        
 	/// read benchmark
 	status = readBenchmark(inputFileName, rst);
 	if(status==0){
 		printf("ERROR: reading input file \n");
 		return 1;
 	}
        /*
        status = evalSolution(outputFileName, rst);
 	if(status==0){
 		printf("ERROR: reading input file \n");
 		return 1;
 	}
        */
        
 	/// run actual routing
 	status = solveRouting(rst);
 	if(status==0){
 		printf("ERROR: running routing \n");
 		release(rst);
 		return 1;
 	}
	
 	/// write the result
 	status = writeOutput(outputFileName, rst);
 	if(status==0){
 		printf("ERROR: writing the result \n");
 		release(rst);
 		return 1;
 	}
        
 	release(rst);
        
        printf("\nDONE!\n");	
 	return 0;
}
